{template 'common/header'}
<div class="main">
	<ul class="nav nav-tabs">
		<li {if $_GPC['do'] == 'votelist'}class="active"{/if}><a href="{php echo $this->createWebUrl('votelist');}">管理</a></li>
		<li {if $_GPC['do'] == 'voteadd'}class="active"{/if}><a href="{php echo $this->createWebUrl('voteadd');}">添加</a></li>
	</ul>
	<div class="search">
		<form action="{php echo $this->createWeburl('votelist')}" method="post">
		  <table class="table table-bordered tb">
			<tbody>
				<tr class="span6">
					<th class="span2">活动名称</th>
					<td class="span2">
						<input class="span2" name="keyword" id="" type="text" value="{$_GPC['keyword']}">
					</td>
                    <td class="span2">
                    <button class="btn pull-right span2"><i class="icon-search icon-large"></i> 搜索</button>
                    </td>
				</tr>
			</tbody>
		</table>
		</form>
	</div>

	<div style="padding:15px;">
		<p>
        <a href="{php echo $this->createWeburl('voteadd', array())}"  class="btn"><i class="icon-plus-sign-alt" ></i>新增</a>
        </p>
		<table class="table table-hover">
			<thead class="navbar-inner">
				<tr>
					<th width="75">活动名称</th>
					<th width="75">开始时间</th>
					<th width="75">结束时间</th>
                    <th width="75">状态</th>
					<th width="100">操作</th>
				</tr>
			</thead>
			<tbody>
				{loop $list $item}
				<tr>
					<td>{$item['title']}</td>
					<td>{php echo date('Y-m-d H:i', $item['start_time'])}</td>
					<td>{php echo date('Y-m-d H:i', $item['end_time'])}</td>
					<td>
                        {if $item['state']}
                        <a id="disable" href="{php echo $this->createWeburl('state', array('tablename' => 'setting', 'id' => $item['id'], 'state' => 0))}" onclick="return ajaxopen(this.href);" class="btn btn-danger  module-button-switch">已关闭</a>
                        {else}
                        <a id="enable"  href="{php echo $this->createWeburl('state', array('tablename' => 'setting', 'id' => $item['id'], 'state' => 1))}" onclick="return ajaxopen(this.href);" class="btn btn-primary module-button-switch">已开启</a>
                        {/if}
					</td>
					<td>
                        <a href="{php echo $this->createWebUrl('voteadd', array('id' => $item['id']))}" class="btn btn-small" title="编辑"><i class="icon-edit"></i></a>
                        <a href="{php echo $this->createWebUrl('optionadd', array('id' => $item['id']))}" class="btn btn-small" title="管理选项"><i class="icon-bookmark"></i></a>
                        <a href="{php echo $this->createWebUrl('voteresult', array('id' => $item['id']))}" class="btn btn-small" title="查看结果"><i class="icon-inbox"></i></a>
                        <a href="{php echo $this->createWebUrl('votelog', array('id' => $item['id']))}" class="btn btn-small" title="查看记录"><i class="icon-search"></i></a>
                        <a href="{php echo $this->createWebUrl('votedelete', array('id' => $item['id']))}" onclick="return confirm('确认删除？');return false;" class="btn btn-small" title="删除"><i class="icon-remove"></i></a>
                    </td>
				</tr>
				{/loop}
				<td colspan="7">
				    <input name="token" type="hidden" value="{$_W['token']}" />
                </td>
			</tr>
		</table>
		{$pager}
	</div>
</div>
{template 'common/footer'}